package com.xxgc.eow.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxgc.eow.entity.Financing;
import com.xxgc.eow.mapper.FinancingMapper;
import com.xxgc.eow.service.IFinancingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 融资类型表 服务实现类
 * </p>
 *
 * @author Mr.Abel
 * @since 2023-05-21
 */
@Service
public class FinancingServiceImpl extends ServiceImpl<FinancingMapper, Financing> implements IFinancingService {

    @Resource
    private FinancingMapper financingMapper;

    @Override
    public List<Financing> getAll() {
        return financingMapper.selectAll();
    }


    @Override
    public List<Financing> getBykeyWord(int pageNum,int pageSize,String keyWord) {
        PageHelper.startPage(pageNum,pageSize);
        return financingMapper.selectBykeyWord(keyWord);
    }

    @Override
    public int updatFinancing(Financing financing) {
        return financingMapper.updateByPrimaryKey(financing);
    }


    @Override
    public int delById(Financing financing) {
        return financingMapper.deleteByPrimaryKey(financing);
    }

    @Override
    public Financing getByFinanId(int financingId) {
        return financingMapper.selectByPrimaryKey(financingId);
    }

    @Override
    public List<Financing> getAllPage(String keyWord) {
        return financingMapper.selectBykeyWord(keyWord);
    }

    @Override
    public int addFinancing(Financing financing) {
        return financingMapper.insert(financing);
    }
}
